﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;

namespace PJ.Data.Inventory
{
    [Serializable]
    [DataContract]
    public class BaseUnitData : BaseItemData, IUnitData
    {
        private int m_Decimals;

        public BaseUnitData()
        {
        }
        public BaseUnitData(BaseUnitData data)
            : base(data)
        {
        }

        [DataMember]
        public int Decimals
        {
            get { return m_Decimals; }
            set { m_Decimals = value; }
        }

        public override IObjectData Copy(IObjectData data)
        {
            base.Copy(data);
            IUnitData _data = (IUnitData)data;
            this.Decimals = _data.Decimals;
            return this;
        }
        public override bool IsEqual(IObjectData data)
        {
            if (base.IsEqual(data))
                if (((IUnitData)data).Decimals == this.Decimals)
                    return true;
            return false;
        }



        public override IObjectData CreateNewInstance()
        {
            return new BaseUnitData();
        }
    }
}
